package com.itheima.common.pojo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * 分页请求封装
 */
@NoArgsConstructor
@AllArgsConstructor
@Data
@ApiModel(value = "PageRequestDto",description = "分页查询请求参数")
public class PageRequestDto<T> implements Serializable {
    //当前页码
    @ApiModelProperty(notes = "查看第几页")
    private Long page = 1L;
    //每页显示的行
    @ApiModelProperty(notes = "每页显示的行",required = true)
    private Long size = 10L;
    //请求体实体对象
    @ApiModelProperty(notes = "请求条件")
    private T body;

    private Long start;

    public Long getStart() {
        return (page -1 )* size;
    }
}
